﻿var RealEditEx = new Class({
    //加载数据
    LoadData: function () {
        //初始化装修下拉框
        dataBind.bindOption(38, "#selDecorationSituationKeyId");
        //家电列表ulAppliance
        var dataAppliance;
        var dataFurniture;
        for (var i = 0; i < SysParam.length; i++) {
            //家电
            if (SysParam[i].ParameterType == 36) {
                dataAppliance = SysParam[i].Items;
            }
            if (SysParam[i].ParameterType == 37) {
                dataFurniture = SysParam[i].Items;
            }
        }
        if (dataAppliance) {
            var liObj = '';
            for (var k = 0; k < dataAppliance.length; k++) {
                var item = realEdit.getElectrics(dataAppliance[k].ItemValue);
                liObj += '<li><label class="tit">' + dataAppliance[k].ItemText + '</label>';
                liObj += '<input type="hidden" name="ElectricKeyId" value="' + dataAppliance[k].ItemValue + '" />';
                liObj += '<label>数量<input name="ElectricCount" isint="1" class="ipt ipt-short" value="' + item.ElectricCount + '" type="text" maxlength="5"/></label>';
                liObj += '<label>品牌<input name="ElectricBrand"  value="' + item.ElectricBrand + '" class="ipt w124" type="text" maxlength="30"/></label></li>';
            }
            $('#ulApplianceValue').before(liObj);
        }
        if (dataFurniture) {
            var liObj2 = '';
            for (var j = 0; j < dataFurniture.length; j++) {
                var item = realEdit.getFurnitures(dataFurniture[j].ItemValue);
                liObj2 += '<li><label class="tit">' + dataFurniture[j].ItemText + '</label>';
                liObj2 += '<input type="hidden" name="FurnitureKeyId" value="' + dataFurniture[j].ItemValue + '" />';
                liObj2 += '<label>数量<input name="FurnitureCount" isint="1" class="ipt ipt-short" type="text" value="' + item.FurnitureCount + '" maxlength="5"/></label>';
                liObj2 += '<label>品牌<input  name="FurnitureBrand" class="ipt w124" type="text" value="' + item.FurnitureBrand + '" maxlength="30"/></label></li>';
            }
            $('#ulFurnitureValue').before(liObj2);
        }
    }

}, realEdit);
realEdit.getElectrics = function (id) {
    for (var i = 0; i < realEdit.electrics.length; i++) {
        if (realEdit.electrics[i].ElectricKeyId == id) {
            return realEdit.electrics[i];
        }
    }
    return { ElectricCount: "", ElectricBrand: "" }
}
realEdit.getFurnitures = function (id) {
    for (var i = 0; i < realEdit.furnitures.length; i++) {
        if (realEdit.furnitures[i].FurnitureKeyId == id) {
            return realEdit.furnitures[i];
        }
    }
    return { FurnitureCount: "", FurnitureBrand: "" }
}
//文本域显示剩余字数
$.inputStatistics("txtRealSurveyComment", 200);